# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cisco-auditing-tool
pkgver=1
pkgrel=10
groups=('blackarch' 'blackarch-cracker' 'blackarch-fuzzer' 'blackarch-scanner')
pkgdesc="Perl script which scans cisco routers for common vulnerabilities. Checks for default passwords, easily guessable community names, and the IOS history bug. Includes support for plugins and scanning multiple hosts."
arch=('any')
url='http://www.scrypt.net'
license=('GPL')
depends=('perl')
source=("https://dl.packetstormsecurity.net/cisco/CiscoAuditingTool-v$pkgver.tar.gz"
        'CAT')
sha512sums=('efaa29edb2d243c23436a36bd48917e0587ecb46c6e815a0e1b0e40864a35525d1d78571dfdac6d2b424f3818ddd1bcb3dcb7d0a174a6f2afadf1b3ceebdfdab'
            'd4ca38d2abe66b61d7842c0213496917b5898610a703fd9863714194132d733be3693c6fdb317ab619929456e175da53fa616339e2c361e8a4453cd30f6016c5')

package() {
  cd CiscoAuditingTool

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/lib"
  install -dm 755 "$pkgdir/usr/share/$pkgname/lib/Net"
  install -dm 755 "$pkgdir/usr/share/$pkgname/plugins"
  install -dm 755 "$pkgdir/usr/share/$pkgname/lists"
  install -Dm 755 "$srcdir/CAT" "$pkgdir/usr/bin/CAT"
  install -Dm 755 CAT "$pkgdir/usr/share/$pkgname/CAT"
  install -Dm 644 TODO "$pkgdir/usr/share/$pkgname/$doc/"

  # This name makes more sense.
  ln -s CAT "$pkgdir/usr/bin/$pkgname"

  cd "$srcdir/CiscoAuditingTool/lib/Net"

  for lib in SNMP.pm Telnet.pm; do
    install -Dm 644 $lib "$pkgdir/usr/share/$pkgname/lib/Net/$lib"
  done

  cd "$srcdir/CiscoAuditingTool/lists"

  for lists in passwords community; do
    install -Dm 644 $lists "$pkgdir/usr/share/$pkgname/lists/$lists"
  done

  cd "$srcdir/CiscoAuditingTool/plugins"

  for plugins in snmp brute ihist usage; do
    install -Dm 644 $plugins "$pkgdir/usr/share/$pkgname/plugins/$plugins"
  done
}

